import 'package:flutter/material.dart';
import 'package:get/get.dart';

class DetailInfoTabDelegate extends SliverPersistentHeaderDelegate {
  final double _extent = 60;

  final TabController tabController;

  DetailInfoTabDelegate(this.tabController);

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return Container(
      height: _extent,
      decoration: const BoxDecoration(
        color: Color(0xFFA66053),
      ),
      child: Container(
        decoration: BoxDecoration(
            color: Get.theme.scaffoldBackgroundColor,
            borderRadius: const BorderRadius.only(
                topLeft: Radius.circular(10), topRight: Radius.circular(10))),
        child: TabBar(
            controller: tabController,
            unselectedLabelColor: Colors.grey,
            indicatorSize: TabBarIndicatorSize.label,
            indicatorWeight: 2,
            isScrollable: true,
            indicatorPadding: const EdgeInsets.symmetric(horizontal: 10),
            indicatorColor: const Color(0xFF7E55FC),
            tabs: const [
              Text(
                "任务介绍",
                style: TextStyle(fontSize: 16),
              ),
              Text(
                "创作指导",
                style: TextStyle(fontSize: 16),
              )
            ]),
      ),
    );
  }

  @override
  double get maxExtent => _extent;

  @override
  double get minExtent => _extent;

  @override
  bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
    return false;
  }
}
